<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    request.setAttribute("basePath", basePath);
%>
<%@ include file="/resources/js/easyui/taglibs.jsp" %>
<%@ include file="/resources/js/wechat/_wechatui.jsp" %>
<%@ include file="/resources/js/easyui/_viewJS.jsp" %>
<!DOCTYPE>
<html>
<head>
    <title>账目详情</title>
</head>
<body>
<div class="loading"></div>
<!-- header -->
<header>
    <a href="javascript:history.go(-1);"
       class="top_fh">${FrequencyStatistic.placeName} ${FrequencyStatistic.deviceName}</a>
</header>
<!-- header end -->

<div class="page zmxq_page">
    <div class="zmxq_lengthinner">
        <ul>
            <c:if test="${FrequencyStatistic.index > 0}">
                <c:forEach items="${FrequencyStatistic.statisticDetails}" var="detail" varStatus="status">
                    <li>
                        <a class="GC_frequency_statistic_a" remark="${detail.balanceid}" index="${FrequencyStatistic.index - status.index}" id="1000${FrequencyStatistic.index - status.index}"
                           href="javascript:void(0);">
                            <c:set value="${FrequencyStatistic.index - status.index}" var="frequencyIndex" />
                            <i><c:if test="${frequencyIndex < 10}">0</c:if>${frequencyIndex}</i>
                            <dl>
                                <dd>现金：${detail.cachTotal}</dd>
                                <dd>一元硬币：${detail.coinTotal}</dd>
                                <dd>微信：${detail.wechatPayTotal}</dd>
                                <dd>支付宝：${detail.alipayPayTotal}</dd>
                                <dd>出币：${detail.outGameCoinAccount}</dd>
                                <dd>出礼品：${detail.outGiftAccount}</dd>
                                <dd>远程补币：${detail.remotelyOutGameCoinAccount}</dd>
                            </dl>
                            <time><fmt:formatDate value="${detail.frequencyTime}"
                                                  pattern="yyyy年MM月dd日 HH:mm:ss"/></time>
                        </a>
                    </li>
                </c:forEach>
            </c:if>
            <c:if test="${FrequencyStatistic.index <= 0}">
                该设备尚未结帐
            </c:if>
        </ul>
    </div>
</div>

<!-- footer -->
<div class="zmxq_footer">
    <a id="CG_device_account" href="javascript:void(0);">按日期</a>
    <a href="javascript:void(0);" class='cur'>按次数</a>
</div>
<!-- footer end -->
</body>
</html>
<script>

    var url_prefix = '${basePath}wechat/income/accounts/${placeid}/';
    var url_param = "placeName=" + encodeURI(encodeURI('${FrequencyStatistic.placeName}')) + "&deviceSerial=" + ${FrequencyStatistic.deviceid} +"&deviceName=" + encodeURI(encodeURI('${FrequencyStatistic.deviceName}'));

    /*按日期查询账目*/
    $("#CG_device_account").click(function () {
        window.location.href = url_prefix + 'thatdayaccount?' + url_param + "&statisticDate=";
    });


    $(".GC_frequency_statistic_a").click(function () {

        var thisBalanceid = $(this).attr("remark");

        var index = parseInt($(this).attr("index"));
        var lastFrequencyid = index - 1;
        var lastBalanceid = $("#1000"+ lastFrequencyid).attr("remark");

        if(typeof(thisBalanceid) == "undefined" || isNaN(thisBalanceid) ){
            thisBalanceid = 0;
        }

        if(typeof(lastBalanceid) == "undefined" || isNaN(lastBalanceid) ){
            lastBalanceid = 0;
        }

        window.location.href = url_prefix + 'thisandlsatstatistic?thisBalanceid=' + encodeURI(encodeURI(thisBalanceid)) +"&lastBalanceid="+encodeURI(encodeURI(lastBalanceid)) +"&index="+encodeURI(encodeURI(index)) + "&"+url_param  ;

    });

</script>